from sqlalchemy import Column, BigInteger, String, CHAR, DateTime
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class SysUser(Base):
    __tablename__ = "sys_user"

    user_id = Column(BigInteger, primary_key=True, comment="用户ID")
    tenant_id = Column(String(20), default="000000", comment="租户编号")
    dept_id = Column(BigInteger, comment="部门ID")
    user_name = Column(String(30), nullable=False, comment="用户账号")
    nick_name = Column(String(30), nullable=False, comment="用户昵称")
    user_type = Column(
        String(10), default="sys_user", comment="用户类型（sys_user系统用户）"
    )
    email = Column(String(50), default="", comment="用户邮箱")
    phonenumber = Column(String(11), default="", comment="手机号码")
    sex = Column(CHAR(1), default="0", comment="用户性别（0男 1女 2未知）")
    avatar = Column(BigInteger, comment="头像地址")
    password = Column(String(100), default="", comment="密码")
    status = Column(CHAR(1), default="0", comment="帐号状态（0正常 1停用）")
    del_flag = Column(CHAR(1), default="0", comment="删除标志（0代表存在 1代表删除）")
    login_ip = Column(String(128), default="", comment="最后登录IP")
    login_date = Column(DateTime, comment="最后登录时间")
